//
//  EntertainmentViewController.m
//  On The Load
//
//  Created by 我爱的妞 on 15/11/5.
//  Copyright © 2015年 @@叶一闽. All rights reserved.
//

#import "EntertainmentViewController.h"
#import "XJCMusicViewController.h"
#import "XJCVideoViewController.h"


@interface EntertainmentViewController ()


@property (nonatomic, strong) UIButton *musicBtn;
@property (nonatomic, strong) UIButton *videoBtn;

@property (nonatomic, strong) XJCMusicViewController *musicVC;
@property (nonatomic, strong) XJCVideoViewController *videoVC;

@end

@implementation EntertainmentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    /****查找字体****/
    //查找字体名
    NSArray *array = [UIFont familyNames];
    for (NSString * familyname in array) {
        NSLog(@"Family:%@",familyname);
        NSArray *fontnames = [UIFont fontNamesForFamilyName:familyname];
        for (NSString *name in fontnames) {
            NSLog(@"Font Name:%@",name);
        }  
    }
    /*************/
    
    
    
//    将EntertainmentViewController作为容器视图控制器,控制音乐和视频两个控制器
    self.musicVC = [[XJCMusicViewController alloc]init];
    self.videoVC = [[XJCVideoViewController alloc]init];
    
    [self addChildViewController:self.musicVC];
    [self addChildViewController:self.videoVC];
    [self.view addSubview:self.musicVC.view];
    [self.view addSubview:self.videoVC.view];
    [self.view bringSubviewToFront:self.musicVC.view];
    
    self.musicBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.musicBtn.frame = CGRectMake(110*SCALEW, 5, 70*SCALEW, 30);
//    self.musicBtn.backgroundColor = [UIColor colorWithRed:0.698 green:1.000 blue:0.828 alpha:1.000];
    [self.musicBtn setTitle:@"Music" forState:UIControlStateNormal];
    [self.musicBtn setTitleColor:[UIColor colorWithWhite:0.702 alpha:1.000] forState:UIControlStateNormal];
    [self.musicBtn setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
    self.musicBtn.selected = YES;
    self.musicBtn.titleLabel.font = [UIFont fontWithName:@"SnellRoundhand-Bold" size:22];
    [self.navigationController.navigationBar addSubview:self.musicBtn];
    [self.musicBtn addTarget:self action:@selector(musicAction) forControlEvents:UIControlEventTouchUpInside];
    self.videoBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.videoBtn.frame = CGRectMake(200*SCALEW, 5, 70*SCALEW, 30);
//    self.videoBtn.backgroundColor = [UIColor colorWithRed:0.698 green:1.000 blue:0.828 alpha:1.000];
    [self.videoBtn setTitleColor:[UIColor colorWithWhite:0.702 alpha:1.000] forState:UIControlStateNormal];

    [self.videoBtn setTitle:@"Video" forState:UIControlStateNormal];
    [self.videoBtn setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
    self.videoBtn.selected = NO;
    [self.videoBtn addTarget:self action:@selector(videoAction) forControlEvents:UIControlEventTouchUpInside];
    //备选字体    BodoniSvtyTwoITCTT-BookIta
    self.videoBtn.titleLabel.font = [UIFont fontWithName:@"SnellRoundhand-Bold" size:22];
    [self.navigationController.navigationBar addSubview:self.videoBtn];
}
-(void)musicAction{
    [self.view bringSubviewToFront:self.musicVC.view];
    self.videoBtn.selected = NO;
    self.musicBtn.selected = YES;
    
}
-(void)videoAction{
    [self.view bringSubviewToFront:self.videoVC.view];
    self.musicBtn.selected = NO;
    self.videoBtn.selected = YES;
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
